iPython notebooks basics

The IPython Notebook is an interactive computational environment, in which you can combine code execution, rich text, mathematics, plots and rich media.

In this section we will show basic Python code being executed and how to document your notebooks using Markdown and Latex.


In [ ]:
print ("Hello world")

In [ ]:
x = 1 + 1
x

Variables created in one cell can be used in another


In [ ]:
y = x + 1
print y

Cells must be run in order for this to work


In [ ]:
a = 1

In [ ]:
b = a + 1
b

Document notebooks

Markdown can be used to add documentation to a notebook.

To change the cell type to markdown Ctrl-m m or click into the cell and select Markdown using the dropdown that defaults to code

Latex formulas

Using MathJax formulas can be added in markdown cells

$y = x$

$c = \sqrt{a^2 + b^2}$

$$3\left(\frac{2}{5}\right)$$
\begin{eqnarray*} 5x^2-9&=&x+3\\ 4x^2&=&12\\ x^3&=&3\\ x&\approx&\pm1.732 \end{eqnarray*}

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: